<?php

/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Cmspage
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */

class Cmspage_AdminFieldsController extends Fields_Controller_AdminAbstract {
	protected $_fieldType = 'cmspage';
	
	protected $_requireProfileType = false;
	
	public function indexAction() {
		// Make navigation
		$this->view->navigation = $navigation = Engine_Api::_ ()->getApi ( 'menus', 'core' )->getNavigation ( 'cmspage_admin_main', array (), 'cmspage_admin_main_fields' );
		
		parent::indexAction ();
	}
	
	public function fieldCreateAction() {
		parent::fieldCreateAction ();
		
		$form = $this->view->form;
		
		if ($form) {
			$form->setTitle ( 'Add Page Question' );
			
			$form->removeElement ( 'display' );
			$form->removeElement ( 'search' );
			
			// Display
			$form->addElement ( 'Select', 'display', array ('label' => 'Show on Page Profiles?', 'multiOptions' => array (1 => 'Show on Page Profiles', 0 => 'Hide on Page Profiles' ) ) );
			
			$form->addElement ( 'Select', 'search', array ('label' => 'Show on the search options?', 'multiOptions' => array (0 => 'Hide on the search options', 1 => 'Show on the search options' ), 'value' => 1 ) );
		}
	}
	
	public function fieldEditAction() {
		parent::fieldEditAction ();
		
		$form = $this->view->form;
		
		if ($form) {
			$form->setTitle ( 'Edit Page Question' );
			
			$form->removeElement ( 'display' );
			$form->removeElement ( 'search' );
			
			// Display
			$form->addElement ( 'Select', 'display', array ('label' => 'Show on Page Profiles?', 'multiOptions' => array (1 => 'Show on Page Profiles', 0 => 'Hide on Page Profiles' ), 'value' => $this->view->display ) );
			
			$form->addElement ( 'Select', 'search', array ('label' => 'Show on the search options?', 'multiOptions' => array (0 => 'Hide on the search options', 1 => 'Show on the search options' ), 'value' => $this->view->search ) );
		}
	}

}